﻿Ext.define('app.prm.project.SummaryStatistics', {
    extend: 'Ext.grid.Panel', 
    enableLocking: true,
    border: false,
    viewConfig: {
        enableTextSelection: true //可以复制单元格文字
    },
    features: [{
        ftype: 'groupingsummary',
        groupHeaderTpl: '{name}',
        hideGroupedHeader: true,
        enableGroupingMenu: false
    }],
    tbar: [],
    initComponent: function () {
        var me = this;
        me.store = Ext.create("app.ux.PrmStore", { url: '/api/services/app/summary/GetStatistics', groupField: 'rdCenter', autoLoad: false });

        var datefield = new Ext.form.field.Date({ value: new Date(), format: 'Y-m-d' });
        me.tbar = [
            "日期：",
            datefield,
            {
                text: '查询', handler: function () {
                    var date = datefield.getValue();
                    me.store.filter = { StartTime: date };
                    me.store.load();
                }
            }
        ];

        me.callParent();
    },
    forceFit: false,
    columns: [
        { header: '研究室', dataIndex: 'laboratory',locked:true },
        { header: '室主任', dataIndex: 'principal' },
        { header: '人数', dataIndex: 'labUserNum' },
        { header: '成员', dataIndex: 'labUserNames' },
        { header: '当前空闲人数', summaryType: 'sum', dataIndex: 'nowStaffNeed' },
        { header: '2周后', summaryType: 'sum', dataIndex: 'twoWeekNeed' },
        { header: '4周后', summaryType: 'sum', dataIndex: 'fourWeekNeed' },
        { header: '6周后', summaryType: 'sum', dataIndex: 'sixWeekNeed' },
        { header: '8周后', summaryType: 'sum', dataIndex: 'eightWeekNeed' },
        { header: '当前需要项目', summaryType: 'sum', dataIndex: 'nowIdleNum' },
        { header: '2周后', summaryType: 'sum', dataIndex: 'twoWeekIdleNum' },
        { header: '4周后', summaryType: 'sum', dataIndex: 'fourWeekIdleNum' },
        { header: '6周后', summaryType: 'sum', dataIndex: 'sixWeekIdleNum' },
        { header: '8周后', summaryType: 'sum', dataIndex: 'eightWeekIdleNum' }
    ]
})